import { Component, OnInit, EventEmitter, Input, Output } from '@angular/core'

@Component({
  selector: 'cp-tab',
  templateUrl: './tab.component.html',
  styleUrls: ['./tab.component.scss']
})
export class TabComponent implements OnInit {
  @Input() items = []
  @Input() inkBarLength: number = 70
  @Input() itemWidth: number = 64
  @Input() gapWidth: number = 32
  @Input() active = 0
  @Output() onTabChange = new EventEmitter<any>()

  constructor() {}

  ngOnInit() {}

  // tab切换回调
  handleTabChange(index,item) {
    this.active = index
    this.onTabChange.emit({
        index:index,
        name:item
    })
  }
}
